package com.xj.sbd.es.web;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class IndexController {

    // nacos config
    @Value("${es.user.name}")
    private String name;
    @Value("${es.user.age}")
    private Integer age;
    @GetMapping({"/","/index.html"})
    public String indexPage(Model model){

//        classpath:/templates/
        System.out.println("name: "+name);
        model.addAttribute("name", name);
        model.addAttribute("age", age);
        // 视图解析器进行拼串
        // classpath:/templates/ + 返回值 + .html
        return "index";
    }
}
